package com.example.controller;


import com.example.pojo.PageBean;
import com.example.pojo.Result;
import com.example.service.impl.OriginPlaceServiceImpl;
import com.example.vd.vo.OriginPlaceVo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author fzy'
 * @since 2024-08-11
 */
@RestController
@CrossOrigin
@Slf4j
@RequestMapping("/originPlace")
public class OriginPlaceController {
    @Autowired
    private OriginPlaceServiceImpl originPlaceService;
    @GetMapping("/list")
    public Result placeList(@ModelAttribute PageBean pageBean){
        log.info("/list 参数: {}", pageBean);
        return originPlaceService.getPlaceList(pageBean);
    }

    @DeleteMapping("/delete")
    public Result deletedById(Long id) {
        log.info("/deleted 参数: {}", id);
        return originPlaceService.deletedById(id);
    }

    @PutMapping("/update")
    public Result updateByPlace(@RequestBody OriginPlaceVo Place) {
        log.info("/update 参数: {}", Place);
        return originPlaceService.updateByPlace(Place);
    }


    @PostMapping("/insert")
    public Result insert(@RequestBody OriginPlaceVo Place) {
        log.info("/insert 参数: {}", Place);
        return originPlaceService.insertByPlace(Place);
    }
}
